{extend name="public:layout" /}

{block name="title"}
    <title>{:site('siteName')}-提现</title>
{/block}

{block name="css"}
    <style>
        .layui-form-label{width:60px;    padding: 9px 6px;}
        .layui-input-block{margin-left:75px;margin-right:10px;}
        .layui-form-item { margin-bottom: 9px;}
        .layui-input::-webkit-input-placeholder{ color: #999;font-size:12px;}
        .layui-input::-moz-placeholder{  color: #999;font-size:12px; }
        .layui-input:-ms-input-placeholder{color: #999;font-size:12px;}
        .layui-tab-title li{width:50%;}
        .layui-tab-content {padding:0;}
        .layui-table td, .layui-table th{padding:5px 2px;}
        .sell-tab { height: 40px; border-bottom: 1px solid #e2e2e2 }
        .sell-tab li { width: 50%; float: left; text-align: center; line-height: 40px; }
        .sell-tab .this { color: #009688; border-bottom: 3px solid #5FB878; margin-bottom: -3px;}
        #sendSms { float: right;margin-right: 11px; }
        #smsTpl { display: none; }
        .sms { margin-right: 115px; }
    </style>
{/block}

{block name="content"}
    <ul class="sell-tab">
        <li class="this">申请提现</li>
        <li>
            <a href="/myWithdraw">提现记录</a>
        </li>
    </ul>
    <div class="invite_yaoqing">
        <p>提现说明：<span class="invite_yaoqing_span"></span></p>
        <blockquote class="layui-elem-quote layui-quote-nm">提现说明：推荐满{$config.withdrawNum}人允许提现，单次最低提现{$config.minWithdraw}元，最高提现{$config.maxWithdraw}元，提现手续费{$config.withdrawFee}%，提现金额扣除{$config.shopping}%返{:config('currency')['shopping']}，提现金额大于{$config.smsAmount}元需要发送短信验证，开放提现时间每日{$config.withdrawStime}-{$config.withdrawEtime}点。</blockquote>
        <p>可提现{:config('currency')['money']}：<span class="invite_yaoqing_span1">{$U.money}</span></p>
    </div>
    <form class="layui-form" action="{:url('index/user/withdraw')}">

        <div class="layui-form-item" style="margin-top: 15px;">
            <label class="layui-form-label">收款方式</label>
            <div class="layui-input-block">
                <select lay-verify="required" name="type">
                    <option value="0">支付宝</option>
                    <option value="1">网银</option>
                </select>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">提现金额</label>
            <div class="layui-input-block">
                <input type="text" name="money" lay-verify="required|number" placeholder="兑换比例1：1" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">支付密码</label>
            <div class="layui-input-block">
                <input type="password" name="pwd" lay-verify="required" placeholder="请输入支付密码" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item" id="smsTpl">
            <!-- 短信验证 -->
            <a class="layui-btn layui-btn-primary" id="sendSms">发送短信</a>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">备注</label>
            <div class="layui-input-block">
                <input type="text" name="note" placeholder="非必填" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label"></label>
            <div class="layui-input-block">
                <input type="hidden" name="mobile" value="{$U.mobile}" />
                <input type="hidden" name="__token__" value="{$Request.token}" />
                <button class="layui-btn layui-btn-main" lay-submit>确定</button>
            </div>
        </div>
    </form>
{/block}

{block name="script"}
    <script type="text/javascript">
        layui.use(['jquery','form'], function(){
    
        var $ = layui.jquery;
        var form = layui.form();

        //表单验证
        $("input[name='money']").change(function(e) {
            var html = '<span class="sms-input"><label class="layui-form-label">短信验证</label>\
                        <div class="layui-input-block sms">\
                            <input type="text" name="code" lay-verify="required|number" placeholder="" class="layui-input">\
                        </div></span>';
            var money = $(this).val();
            var maxMoney = parseInt("{$config.smsAmount}");
            if(money > maxMoney){
                layer.msg('提现金额大于'+maxMoney+'需要短信验证');
                $("#smsTpl").append(html).show();
            }else{
                $(".sms-input").remove();
                $("#smsTpl").hide();
            }
        });

    });
    </script>
{/block}